/*
 * Created on November 6, 2007
 *
 * Copyright (c) Patrick Armstrong 2002-2007. All Rights Reserved.
 */
package org.dime.mine.game.actions;

import java.util.List;

/**
 * Process // TODO Add type summary
 * 
 * @author Owner
 */
public abstract class Process implements Executable
{
    private final List<? extends Executable> executables;

    public Process(List<? extends Executable> executables)
    {
        this.executables = executables;
    }

    public List<? extends Executable> getExecutables()
    {
        return executables;
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.dime.mine.game.actions.Executable#execute()
     */
    @Override
    public void execute()
    {
        for (Executable exec : executables)
        {
            exec.execute();
        }
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj)
    {
        if (obj instanceof Process)
        {
            Process proc = (Process) obj;
            return getClass().equals(proc.getClass())
                    && getExecutables().equals(proc.getExecutables());
        }
        return super.equals(obj);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        return getClass().hashCode() + getExecutables().hashCode();
    }
}
